package homework2;

public class StuTest {
    public static void main(String[] args) {
        Student[]stu=new Student[10];
        for(int i=0;i<stu.length;i++)
        {
            stu[i]=new Student();
            stu[i].setStuName(RandomStu.getRandomName());
            stu[i].setStuAge(RandomStu.getRandomAge());
            stu[i].setStuSex(RandomStu.getRandomSex());
        }

        Student stu1=new Student("李浩晨","男",22);
        int flag=0;
       for (int j=0;j<stu.length;j++)
        {
            System.out.println("Name:"+stu[j].getStuName()+'\t'+"Age:"+stu[j].getStuAge()+'\t'+"Sex:"+stu[j].getStuSex());
            boolean resule=stu[j].equals(stu1);
            if(resule)
                System.out.println("该数组含有此对象");

            else
                flag=1;
        }
      if(flag==1)
      {
          System.out.println();
          System.out.println("无此对象");
      }
    }
}
